function [out, rmse] = predict_ratings(test,U,V,T)

out = zeros(size(test,1),1);

for it=1:size(test,1)
    UU = U(:,test(it,2));
    VV = V(:,test(it,3));
    TT = T(:,test(it,1));
    out(it,1) = (UU.*VV)'*TT;
end

out(out>5) = 5;
out(out<1) = 1;

rmse = sqrt(mean((out-double(test(:,4))).^2));


